package com.imchenio.springscheduleexample.instance02;

import com.imchenio.springscheduleexample.common.util.SpringUtil;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConfigurerScheduleController {

    @PostMapping("/configurer-schedule/cron")
    public void changeCorn(String cron) {
        if (StringUtils.isEmpty(cron)) {
            return;
        }
        SpringUtil.getCtx().getBean(ConfigurerSchedule.class).setCron(cron);
    }
}
